USE [Weval test]
GO

/****** Object:  StoredProcedure [dbo].[ProfessorsWithAnswers]    Script Date: 7/8/2013 7:21:47 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO



ALTER PROCEDURE [dbo].[ProfessorsWithAnswers] @Dept nvarchar(4)
AS
--DECLARE @Dept nvarchar(20)= 'CS';

SELECT DISTINCT
	ST.instructorID,
	U.FirstName,
	U.LastName
FROM CourseSections CS
	INNER JOIN SectionsTaught ST ON CS.ID = ST.sectionID
	INNER JOIN Users U ON U.Id = ST.instructorID
		AND CS.subjectCode = @Dept
	ORDER BY U.LastName, U.FirstName
GO